package com.qingcheng.consumer;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;

import java.util.Map;

public class SmsMessageConsumer implements MessageListener {


    @Override
    public void onMessage(Message message) {

        String stringJson = new String(message.getBody());
        Map<String , String> map = (Map)JSON.parseObject(stringJson);
        String phone = map.get("phone");
        String code = map.get("code");

        System.out.println("手机号："+phone+"，验证码："+code);
    }
}
